<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">

<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <input type="hidden" name="dateNow" id="dateNow"
                       th:value="${#dates.format(new java.util.Date().getTime(), 'yyyy-MM-dd')}"/>
                <div class="select-list">
                    <ul>
                        <li>
                            商户编号：<input type="text" name="params[merchantNo]"/>
                        </li>

                        <li>
                            商户名称：<input type="text" name="params[merchantCnName]"/>
                        </li>


                        <li class="select-time">
                            <label>创建时间： </label>
                            <input type="text" class="time-input" id="beginTime" placeholder="开始时间"
                                   name="params[beginTime]"/>
                            <span>-</span>
                            <input type="text" class="time-input" id="endTime" placeholder="结束时间"
                                   name="params[endTime]"/>
                        </li>

                        <li>
                            身份证号：<input type="text" name="params[idCardNumber]"/>
                        </li>
                        <li>
                            真实姓名：<input type="text" name="params[bankAccountName]"/>
                        </li>
                        <li>
                            银行卡号：<input type="text" name="params[bankAccount]"/>
                        </li>

                        <li>
                            审核状态：
                            <select name="params[increaseLimitStatus]"
                                    th:with="type=${@dict.getType('sys_increase_Status')}">
                                <option value="">所有</option>
                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
                                        th:value="${dict.dictValue}"></option>
                            </select>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="search1()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="reset('formId')"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm hidden-xs" id="toolbar" role="group">
            <a class="btn btn-warning" onclick="$.table.exportExcel()"
               shiro:hasPermission="system:merchantIncreaseLimit:export">
                <i class="fa fa-download"></i> 导出
            </a>
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table" data-mobile-responsive="true"></table>
        </div>
    </div>
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
    function search1() {
        $.table.search("formId");
    }
    //重置form
    function reset(formId) {
        var currentId = $.common.isEmpty(formId) ? $('form').attr('id') : formId;
        $("#" + currentId)[0].reset();
    }
    $(function () {
        $("#beginTime").val($("#dateNow").val()+" 00:00:00")
        $("#endTime").val($("#dateNow").val()+" 23:59:59")
    })

    var listFlag = [[${@permission.hasPermi('system:merchant:list')}]];
    var removeFlag = [[${@permission.hasPermi('system:merchant:remove')}]];
    var prefix = ctx + "system/merchantIncreaseLimit";
    var datas = [[${@dict.getType('sys_increase_Status')}]];
    $(function () {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            modalName: "商户信用卡",
            queryParams: queryParams,
            sortName: "m.createTime",
            sortOrder: "desc",
            search: false,
            showExport: true,
            columns: [{
                checkbox: true
            },
                {
                    field: 'id',
                    title: 'id',
                    visible: false
                },
                {
                    field: 'merchantNo',
                    title: '商户编号',
                    visible: true,
                    align: 'center',
                },
                {
                    field: 'merchantCnName',
                    title: '商户名称',
                    align: 'center',
                    visible: true
                },
                {
                    field: 'bankNames',
                    title: '银行名称',
                    align: 'center',
                    visible: true,
                    formatter: function (value, row, index) {
                        return "<strong style='color: #1E0FBE's>" + value + "</strong>";
                    }
                },
                {
                    field: 'bankAccount',
                    title: '银行卡号',
                    align: 'center',
                    visible: true
                },
                {
                    field: 'cvn',
                    title: 'CVN',
                    align: 'center',
                    visible: true,
                    formatter: function (value, row, index) {
                        return "<strong style='color: red's>" + value + "</strong>";
                    }
                },
                {
                    field: 'expdate',
                    title: '有效期',
                    align: 'center',
                    visible: true,
                    formatter: function (value, row, index) {
                        return "<strong style='color: blue's>" + value + "</strong>";
                    }
                },
                {
                    field: 'bankAccountName',
                    title: '姓名',
                    align: 'center',
                    visible: true
                },
                {
                    field: 'idCardNumber',
                    title: '身份证号',
                    align: 'center',
                    visible: true
                },

                {
                    field: 'increaseLimitStatus',
                    title: '审核状态',
                    align: 'center',
                    visible: true,
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(datas, value);
                    }
                },
                {
                    field: 'createTime',
                    title: '创建时间',
                    align: 'center',
                    visible: true
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-info btn-xs ' + listFlag + '" href="#" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>设置CVN</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }
            ]
        };
        $.table.init(options);
    });

    function queryParams(params) {
        return {
            "params[beginTime]": $("#beginTime").val(),
            "params[endTime]": $("#endTime").val(),
            pageSize: params.limit,
            pageNum: params.offset / params.limit + 1,
            searchValue: params.search,
            orderByColumn: params.sort,
            isAsc: params.order
        };
    }

    //详情	detailUrl: prefix + "//{id}",
    function detail(id) {
        var url = prefix + '/detail/' + id;
        createMenuItem(url, "查看详情");
    }
</script>
</body>
</html>